{extend name="$base" /}
{block name="resources"}
<link type="text/css" rel="stylesheet" href="WEB_CSS/goods_groupbuy.css">
{/block}
{block name="lunbo"}
{php}
	//轮播
	$banner_list = api('System.Shop.advDetail', ['ap_keyword' => 'PC_GROUP_BAY_SWIPER', 'export_type' => 'data']);
{/php}
<!-- 轮播 -->
<div class="banner-wrap">
	{notempty name='$banner_list["data"]'}
	<div id="banner" class="carousel slide" data-ride="carousel">
		<ol class="carousel-indicators">
			{foreach name="$banner_list['data']['advs']" item="vo" key="k"}
			<li data-target="#banner" data-slide-to="{$k}" {if condition="$k==0"}class="active"{/if}></li>
			{/foreach}
		</ol>

		<div class="carousel-inner">
			{foreach name="$banner_list['data']['advs']" item="vo" key="k"}
			<div class="item {if condition='$k==0'}active{/if}" style="background-color:{$vo['background']}">
				{if $vo['adv_image'] == ''}
				<a href="javascript:;"><img alt="轮播图" src="WEB_IMG/index/default_banner.png" ></a>
				{else/}
				{if is_url($vo['adv_url'])}
					<a href="{$vo['adv_url']}" target="_blank" style="width: {$banner_list['data']['ap_width']}px;height: {$banner_list['data']['ap_height']}px;line-height: {$banner_list['data']['ap_height']}px;">
				{else/}
					<a href="{:__URL('SHOP_MAIN'.$vo['adv_url'])}" target="_blank" style="width: {$banner_list['data']['ap_width']}px;height: {$banner_list['data']['ap_height']}px;line-height: {$banner_list['data']['ap_height']}px;">
				{/if}
					<img alt="轮播图" src="{:__IMG($vo['adv_image'])}"  onerror="this.src='WEB_IMG/index/default_banner.png'">
				</a>
				{/if}
			</div>
			{/foreach}
		</div>

		<a class="left carousel-control" href="#banner" data-slide="prev">
			<span class="icon icon-chevron-left"></span>
		</a>
		<a class="right carousel-control" href="#banner" data-slide="next">
			<span class="icon icon-chevron-right"></span>
		</a>
	</div>
	{/notempty}
</div>

{/block}
{block name="main"}
{php}
	$data = api('NsGroupBuy.GroupBuy.goodsList', ['page_index' => $page]);
	$group_goods_list = $data['data'];
	$total_count = $data['data']['total_count'];
	$page_count = $data['data']['page_count'];
{/php}

{notempty name="$group_goods_list['data']"}
<ul class="product-list clearfix" id="product_list">
	{volist name="$group_goods_list['data']" id="vo"}
	<li class="ns-border-color">
		<a href="{:__URL('SHOP_MAIN/goods/detail','goods_id='.$vo['goods_id'])}" title="{$vo.goods_name}" class="link">
			{if $vo['picture']['pic_cover_mid']}
			<img src="{:__IMG($vo['picture']['pic_cover_mid'])}">
			{else /}
			<img src="WEB_IMG/discount_product_default.png">
			{/if}
			<h4>{$vo.goods_name}</h4>
		</a>
		<div class="info start ns-border-color">
			<div>
				<div class="price">
					<i class="ns-text-color">{$vo.group_price}</i>
				</div>
				<div class="tip">
					<i>买越多省越多</i>
				</div>
			</div>
			<a href="{:__URL('SHOP_MAIN/goods/detail','goods_id='.$vo['goods_id'])}">
			<span class="buy ns-bg-color">团购</span>
			</a>
		</div>
	</li>
	{/volist}
</ul>
<ul class="pager" data-ride="pager" data-elements="prev,nav,next,total_page_text,goto" data-rec-per-page="{$page_size}" data-page="{$page}" data-rec-total="{$total_count}" id="my_pager"></ul>
{else/}
<!--<div class="empty">还没有相关内容</div>-->
{/notempty}
{/block}
{block name="script"}
<script>
$('#my_pager').pager({
	linkCreator: function(page, pager) {
		return __URL("SHOP_MAIN/goods/groupbuy?page="+page);
	}
});
</script>
{/block}